#include <iostream>
using namespace std;



void usage(const char* exeName)
{
	printf("Usage:%s -c config_file -g group -s start|stop|restart\n", exeName);
	printf("Example:%s -c test.spio -g test -s start\n", exeName);
}

int getOption (int argc, char* argv[])
{
	int rc; 
	while ( (rc = getopt(argc, argv, "c:g:s:h")) != -1 )
	{
		switch(rc)
		{   
			case 'c':
				g_configfile = optarg;
				break;  
			case 'g':
				g_groupname = optarg;
				break;
			case 's':
				if(strcmp(optarg,"start") == 0 ||
						strcmp(optarg,"restart") == 0 ||  
						strcmp(optarg,"stop") == 0)  
					g_cmd = optarg;
				else
				{   
					usage(argv[0]);
					return -1; 
				}   
				break;
			case 'h':
			default:
				usage(argv[0]);
				return -1; 
		}   
	}
	return 0;
}
